<template>
	<view class="w-screen m-h-screen relative bg083d41" @click="toIndex">
		<template v-if="result">
			<image class="w-full" src="@/static/image/steer_bg.png" mode="widthFix"></image>
			<view class="absolute pl-10 w-156n h-134n t-235n z-index-10 position-center-x flex-col textfff">
				<view v-html='threadInfoData?.need_know'></view>
			</view>
		</template>
	</view>
</template>

<script setup>
	import {
		useAuthori,
		useThreadInfo
	} from '@/hooks'
	import {
		getQueryString
	} from '@/static/js/common.js';
	const appid = "wx1cd57328fcb86010";
	const {
		getThreadInfo
	} = useThreadInfo()
	const {
		getWechatCode
	} = useAuthori()
	const result = ref(false)
	const threadInfoData = ref()
	onLoad(async () => {
		uni.showLoading({
			title: '加载中'
		})
		const hasOpen = uni.getStorageSync('hasOpen')
		if (hasOpen) {
			uni.hideLoading()
			uni.switchTab({
				url: '/pages/index/index',
				animationType: 'pop-in',
				animationDuration: 300
			});
		} else {
			const res = await getThreadInfo()
			uni.hideLoading()
			result.value = true
			threadInfoData.value = res.info
		}
	})
	const toIndex = () => {
		const token = uni.getStorageSync('token')
		if (!token) {
			uni.setStorageSync('token',
				'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJwd2QiOiJkNDFkOGNkOThmMDBiMjA0ZTk4MDA5OThlY2Y4NDI3ZSIsImlzcyI6Inp5cy5lbGVjdWwuY29tIiwiYXVkIjoienlzLmVsZWN1bC5jb20iLCJpYXQiOjE3MTcwOTMxOTAsIm5iZiI6MTcxNzA5MzE5MCwiZXhwIjoxNzE5Njg1MTkwLCJqdGkiOnsiaWQiOjQsInR5cGUiOiJhcGkifX0.MIhQj1Ihz3gL-fxPkslcR_NixgGT8PhG45MzEQY-3eg'
			)
			// getWechatCode()
		} else {
			uni.switchTab({
				url: '/pages/index/index',
				animationType: 'pop-in',
				animationDuration: 300
			});
		}
	}
</script>

<style scoped>
	.t-235n {
		top: 940rpx;
	}

	.bg083d41 {
		background: #083d41;
	}
</style>